package com.yayo.mangement.service.impl;

import com.yayo.mangement.dao.GeneraterTableDao;
import com.yayo.mangement.model.GeneraterTableDO;
import com.yayo.mangement.paging.PageInfo;
import com.yayo.mangement.paging.Paging;
import com.yayo.mangement.service.GeneraterTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * 
 * @author: Yayo
 * @date: 2020-07-13 23:48:21
 */
@Service
public class GeneraterTableServiceImpl implements GeneraterTableService {

    @Autowired
    private GeneraterTableDao generaterTableDao;

    @Override
    public Paging<GeneraterTableDO> paging(Integer pageNo, Integer pageSize, Map<String,Object> params){
        PageInfo pageInfo = new PageInfo(pageNo, pageSize);
        params.put("limit", pageInfo.getLimit());
        params.put("offset", pageInfo.getOffset());
        return generaterTableDao.paging(params);
    }

    @Override
    public GeneraterTableDO findById(Long id){
        return generaterTableDao.findById(id);
    }

    @Override
    public Boolean create(GeneraterTableDO generaterTableDO){
        return generaterTableDao.create(generaterTableDO);
    }

    @Override
    public Boolean updateById(GeneraterTableDO generaterTableDO){
        return generaterTableDao.update(generaterTableDO);
    }

    @Override
    public Boolean delete(Long id){
        return generaterTableDao.delete(id);
    }

    @Override
    public Integer creates(List<GeneraterTableDO> generaterTableDOList) {
        return generaterTableDao.creates(generaterTableDOList);
    }

    @Override
    public List<GeneraterTableDO> findByTableName(String tableName) {
        return this.findByTableNameList(Arrays.asList(tableName));
    }

    @Override
    public List<GeneraterTableDO> findByTableNameList(List<String> tableNameList) {
        return generaterTableDao.findByTableNameList(tableNameList);
    }
}